<extend name="Member:base" />
<block name="title"><title>心心向善-修改头像</title></block>
		<!-- 头部结束-->
<block name="body">

			
			<!--<主要区块>-->
			<div class="right-layout">
		    <!--<script type="text/javascript" src="http://www.rate.net/data/resource/js/jquery.Jcrop/jquery.Jcrop.js"></script>-->
			<!--<link href="http://www.rate.net/data/resource/js/jquery.Jcrop/jquery.Jcrop.min.css" rel="stylesheet" type="text/css" id="cssfile2">-->
			<div class="wrap">
			  <div class="tabmenu">
			    <ul class="tab pngFix">
			  <li class="normal"><a href="/member/info.html">基本信息</a></li>
			  <li class="active"><a href="/member/xgtx.html">更换头像</a></li></ul>
			  </div>
			    <form action="xgtx" id="form_avaster" method="post" enctype="multipart/form-data">
			    <input type="hidden" name="form_submit" value="ok">
			    <div class="ncm-default-form">
			      <dl>
			        <dt>头像预览：</dt>
			        <dd>
			          <div class="user-avatar">
						  <span>
						  	<if condition="$UserInfo.userpic eq ''" >
							<img src="__PUBLIC__/Home/images/default_user_portrait.gif"  alt="" nc_type="avatar">
							<else/>
							<img src="{$UserInfo.userpic}"  alt="" nc_type="avatar" style="max-width: 120px;max-height: 120px;">
							</if>
						  </span>
					  </div>
			          <p class="hint mt5">完善个人信息资料，上传头像图片有助于您结识更多的朋友。<br><span style="color:orange;">头像默认尺寸为120x120像素，请根据系统操作提示进行裁剪并生效。</span></p>
			        </dd>
			      </dl>
			      <dl>
			        <dt>更换头像：</dt>
			        <dd>
			          <div class="ncm-upload-btn"> <a href="javascript:void(0);"><span>
			            <input type="file" hidefocus="true" size="1" class="input-file" name="pic" id="pic" file_id="0" multiple="" maxlength="0">
						 <input type="hidden" name="pichash" id="pichash" value="">
			            </span>
			            <p>图片上传</p>
			            <input id="submit_button" style="display:none" type="button" value="&nbsp;" onclick="submit_form($(this))">
			            </a> </div>
			        </dd>
			      </dl>
			    </div>
			  </form>
			  </div>
			<script type="text/javascript">
			$(function(){

				$('#pic').change(function(){
					var filepatd=$(this).val();
					var extStart=filepatd.lastIndexOf(".");
					var ext=filepatd.substring(extStart,filepatd.lengtd).toUpperCase();
					if(ext!=".PNG"&&ext!=".GIF"&&ext!=".JPG"&&ext!=".JPEG"){
						alert("文件类型错误，请选择图片文件（png|gif|jpg|jpeg）");
						$(this).attr('value','');
						return false;
					}
					$("#pichash").val(_getRandomString(32));
					if ($(this).val() == '') return false;
					
					$("#form_avaster").submit();
				});
			});
				// 获取长度为len的随机字符串  
				function _getRandomString(len) {  
					len = len || 32;  
					var $chars = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678'; // 默认去掉了容易混淆的字符oOLl,9gq,Vv,Uu,I1  
					var maxPos = $chars.length;  
					var pwd = '';  
					for (i = 0; i < len; i++) {  
						pwd += $chars.charAt(Math.floor(Math.random() * maxPos));  
					}  
					return pwd;  
				} 
			</script>  </div>
			<!--</主要区块>-->
			<div class="clear"></div>
		</div>
</block>